#define _CRT_SECURE_NO_WARNINGS 1
#include <stdio.h>

int main()
{
    int n, i, j, flag = 0;
    int a[11][11] = { 0 };
    scanf("%d", &n);
    for (i = 0; i < n; i++)
    {
        for (j = 0; j < n; j++)
        {
            scanf("%d", &a[i][j]);
        }
    }
    for (i = 1; i < n; i++)
    {
        for (j = 0; j < i; j++)
        {
            if (a[i][j] != 0)
            {
                flag = 1;
                break;
            }
        }
    }
    if (flag == 1)
        printf("NO\n");
    else
        printf("YES\n");
    return 0;
}